import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)//vue的插件机制

const defaultState = {
  token: uni.getStorageSync('Token'),
  memberId: 0,
  avatar: '',
  articleCategoryId: '',
}
const store = new Vuex.Store({
    state: defaultState,
    getters: {
      token: state => state.token,
      memberId: state => state.memberId,
    },
    mutations: {
      setToken(state, token) {
        state.token = token
      },
      setMemberId(state, memberId) {
        state.memberId = memberId
      },
    }
})
export default store